#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>

void rotate(int* nums, int len, int k)
{
	int* tmp = (int*)malloc(sizeof(int) * len);
	if (tmp == NULL)
	{
		perror("malloc");
		return;
	}
	memcpy(tmp, nums + len - k, k*sizeof(int));
	memcpy(tmp+k, nums, (len - k)*sizeof(int));
	memcpy(nums, tmp, len* sizeof(int));
	free(tmp);
	tmp = NULL;
}



int main()
{
	int nums[] = {1,2,3,4,5,6,7};
	int len = sizeof(nums) / sizeof(nums[0]);
	int k = 0;
	scanf("%d", &k);
	rotate(nums, len, k);
	int i = 0;
	for (i = 0; i < len; i++)
	{
		printf("%d ", nums[i]);
	}
	printf("\n");
	return 0;
}